home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Gobby 0.4.7 / gobby-0.4.7.exe / {app} / share / gtksourceview-2.0 / language-specs / csharp.lang < prev    next >
Extensible Markup Language  |  2008-09-09  |  8KB  |  254 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.  Author: John Luke <jluke@cfl.rr.com>
  5.  Copyright (C) 2003 John Luke <jluke@cfl.rr.com>
  6.  Copyright (C) 2004 Jeroen Zwartepoorte <jeroen@xs4all.nl>
  7.  Copyright (C) 2004 Alessio Frusciante <algol@firenze.linux.it>
  8.  Copyright (C) 2005 Brion Vibber <brion@pobox.com>
  9.  
  10.  This library is free software; you can redistribute it and/or
  11.  modify it under the terms of the GNU Library General Public
  12.  License as published by the Free Software Foundation; either
  13.  version 2 of the License, or (at your option) any later version.
  14.  
  15.  This library is distributed in the hope that it will be useful,
  16.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18.  Library General Public License for more details.
  19.  
  20.  You should have received a copy of the GNU Library General Public
  21.  License along with this library; if not, write to the
  22.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  23.  Boston, MA 02111-1307, USA.
  24.  
  25. -->
  26. <language id="c-sharp" _name="C#" version="2.0" _section="Sources">
  27.   <metadata>
  28.     <property name="mimetypes">text/x-csharpsrc;text/x-csharp</property>
  29.     <property name="globs">*.cs</property>
  30.     <property name="line-comment-start">//</property>
  31.     <property name="block-comment-start">/*</property>
  32.     <property name="block-comment-end">*/</property>
  33.   </metadata>
  34.  
  35.   <styles>
  36.     <style id="comment" _name="Comment" map-to="def:comment"/>
  37.     <style id="error" _name="Error" map-to="def:error"/>
  38.     <style id="type" _name="Data Type" map-to="def:type"/>
  39.     <style id="string" _name="String" map-to="def:string"/>
  40.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  41.     <style id="preprocessor" _name="Preprocessor" map-to="def:preprocessor"/>
  42.     <style id="null-value" _name="Null Value" map-to="def:special-constant"/>
  43.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  44.     <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
  45.     <style id="hexadecimal" _name="Hexadecimal number" map-to="def:base-n-integer"/>
  46.     <style id="real" _name="Real number" map-to="def:floating-point"/>
  47.   </styles>
  48.  
  49.   <definitions>
  50.  
  51.     <context id="line-comment" style-ref="comment" end-at-line-end="true">
  52.       <start>//</start>
  53.       <include>
  54.         <context ref="def:in-line-comment"/>
  55.       </include>
  56.     </context>
  57.  
  58.     <context id="multiline-comment" style-ref="comment">
  59.       <start>/\*</start>
  60.       <end>\*/</end>
  61.       <include>
  62.         <context ref="def:in-comment"/>
  63.       </include>
  64.     </context>
  65.  
  66.     <context id="close-comment-outside-comment" style-ref="error">
  67.       <match>\*/(?!\*)</match>
  68.     </context>
  69.  
  70.     <define-regex id="preproc-start">^\s*#\s*</define-regex>
  71.  
  72.     <context id="if-false-comment" style-ref="comment">
  73.       <start>\%{preproc-start}if\s*false\b</start>
  74.       <end>\%{preproc-start}(endif|else|elif)\b</end>
  75.       <include>
  76.         <context id="if-in-if-false">
  77.           <start>\%{preproc-start}if(n?def)?\b</start>
  78.           <end>\%{preproc-start}endif\b</end>
  79.           <include>
  80.             <context ref="if-in-if-false"/>
  81.             <context ref="def:in-comment"/>
  82.           </include>
  83.         </context>
  84.         <context ref="def:in-comment"/>
  85.       </include>
  86.     </context>
  87.  
  88.     <context id="preprocessor" style-ref="preprocessor" end-at-line-end="true">
  89.       <start extended="true">
  90.         \%{preproc-start}
  91.         (define|undef|if(n?def)?|else|elif|endif|line|error|warning|region|endregion)
  92.         \b
  93.       </start>
  94.       <include>
  95.         <context ref="line-comment"/>
  96.         <context ref="multiline-comment"/>
  97.       </include>
  98.     </context>
  99.  
  100.     <context id="multiline-string" style-ref="string">
  101.       <start>@"([^"]|"")*</start>
  102.       <end>"</end>
  103.       <include>
  104.         <context ref="def:escape"/>
  105.         <context ref="def:line-continue"/>
  106.       </include>
  107.     </context>
  108.  
  109.     <context id="keywords" style-ref="keyword">
  110.       <keyword>class</keyword>
  111.       <keyword>delegate</keyword>
  112.       <keyword>enum</keyword>
  113.       <keyword>event</keyword>
  114.       <keyword>interface</keyword>
  115.       <keyword>namespace</keyword>
  116.       <keyword>struct</keyword>
  117.       <keyword>using</keyword>
  118.       <keyword>abstract</keyword>
  119.       <keyword>const</keyword>
  120.       <keyword>explicit</keyword>
  121.       <keyword>extern</keyword>
  122.       <keyword>fixed</keyword>
  123.       <keyword>implicit</keyword>
  124.       <keyword>internal</keyword>
  125.       <keyword>lock</keyword>
  126.       <keyword>out</keyword>
  127.       <keyword>override</keyword>
  128.       <keyword>params</keyword>
  129.       <keyword>partial</keyword>
  130.       <keyword>private</keyword>
  131.       <keyword>protected</keyword>
  132.       <keyword>public</keyword>
  133.       <keyword>ref</keyword>
  134.       <keyword>sealed</keyword>
  135.       <keyword>static</keyword>
  136.       <keyword>readonly</keyword>
  137.       <keyword>unsafe</keyword>
  138.       <keyword>virtual</keyword>
  139.       <keyword>volatile</keyword>
  140.       <keyword>add</keyword>
  141.       <keyword>as</keyword>
  142.       <keyword>assembly</keyword>
  143.       <keyword>base</keyword>
  144.       <keyword>break</keyword>
  145.       <keyword>case</keyword>
  146.       <keyword>catch</keyword>
  147.       <keyword>checked</keyword>
  148.       <keyword>continue</keyword>
  149.       <keyword>default</keyword>
  150.       <keyword>do</keyword>
  151.       <keyword>else</keyword>
  152.       <keyword>finally</keyword>
  153.       <keyword>for</keyword>
  154.       <keyword>foreach</keyword>
  155.       <keyword>get</keyword>
  156.       <keyword>goto</keyword>
  157.       <keyword>if</keyword>
  158.       <keyword>in</keyword>
  159.       <keyword>is</keyword>
  160.       <keyword>new</keyword>
  161.       <keyword>remove</keyword>
  162.       <keyword>return</keyword>
  163.       <keyword>set</keyword>
  164.       <keyword>sizeof</keyword>
  165.       <keyword>stackalloc</keyword>
  166.       <keyword>super</keyword>
  167.       <keyword>switch</keyword>
  168.       <keyword>this</keyword>
  169.       <keyword>throw</keyword>
  170.       <keyword>try</keyword>
  171.       <keyword>typeof</keyword>
  172.       <keyword>unchecked</keyword>
  173.       <keyword>value</keyword>
  174.       <keyword>void</keyword>
  175.       <keyword>while</keyword>
  176.       <keyword>yield</keyword>
  177.     </context>
  178.  
  179.     <context id="primitives" style-ref="type">
  180.       <keyword>bool</keyword>
  181.       <keyword>byte</keyword>
  182.       <keyword>char</keyword>
  183.       <keyword>decimal</keyword>
  184.       <keyword>double</keyword>
  185.       <keyword>float</keyword>
  186.       <keyword>int</keyword>
  187.       <keyword>long</keyword>
  188.       <keyword>object</keyword>
  189.       <keyword>operator</keyword>
  190.       <keyword>sbyte</keyword>
  191.       <keyword>short</keyword>
  192.       <keyword>string</keyword>
  193.       <keyword>uint</keyword>
  194.       <keyword>ulong</keyword>
  195.       <keyword>ushort</keyword>
  196.     </context>
  197.  
  198.     <context id="null-value" style-ref="null-value">
  199.       <keyword>null</keyword>
  200.     </context>
  201.  
  202.     <context id="boolean" style-ref="boolean">
  203.       <keyword>false</keyword>
  204.       <keyword>true</keyword>
  205.     </context>
  206.  
  207.     <context id="decimal" style-ref="decimal">
  208.       <match extended="true">
  209.         (?<![\w\.])
  210.         [0-9]+[uUlL]*
  211.         (?![\w\.])
  212.       </match>
  213.     </context>
  214.  
  215.     <context id="hexadecimal" style-ref="hexadecimal">
  216.       <match extended="true">
  217.         (?<![\w\.])
  218.         0[xX][a-fA-F0-9]+[uUlL]*
  219.         (?![\w\.])
  220.       </match>
  221.     </context>
  222.  
  223.     <context id="real" style-ref="real">
  224.       <match extended="true">
  225.         (?<![\w\.])
  226.         ((\.[0-9]+|[0-9]+\.[0-9]*)([Ee][+-]?[0-9]*)?[FfDdMm]?|
  227.          ([0-9]+[Ee][+-]?[0-9]*)[FfDdMm]? |
  228.          ([0-9]+)[FfDdMm])
  229.         (?![\w\.])
  230.       </match>
  231.     </context>
  232.  
  233.     <context id="c-sharp">
  234.       <include>
  235.         <context ref="def:string"/>
  236.         <context ref="def:single-quoted-string"/>
  237.         <context ref="line-comment"/>
  238.         <context ref="multiline-comment"/>
  239.         <context ref="close-comment-outside-comment"/>
  240.         <context ref="multiline-string"/>
  241.         <context ref="if-false-comment"/>
  242.         <context ref="preprocessor"/>
  243.         <context ref="keywords"/>
  244.         <context ref="primitives"/>
  245.         <context ref="null-value"/>
  246.         <context ref="boolean"/>
  247.         <context ref="decimal"/>
  248.         <context ref="hexadecimal"/>
  249.         <context ref="real"/>
  250.       </include>
  251.     </context>
  252.   </definitions>
  253. </language>
  254.